import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "./directive";
import "./directive/mouseenter";
import { useLocalStorage, useMouse, usePreferredDark } from "@vueuse/core";

// export default {
//   setup() {
//     // tracks mouse position
//     const { x, y } = useMouse()

//     // is user prefers dark theme
//     const isDark = usePreferredDark()

//     // persist state in localStorage
//     const store = useLocalStorage(
//       'my-storage',
//       {
//         name: 'Apple',
//         color: 'red',
//       },
//     )

//     return { x, y, isDark, store }
//   },
// }

import SvgIcon from "./components/SvgIcon/index.vue";
// 映射svg资源
const req = require.context("./icons/svg", false, /\.svg$/);
const requireAll = (requireContext) =>
  requireContext.keys().map(requireContext);
requireAll(req);

Vue.component("svg-icon", SvgIcon);

// 图片滑动验证
import SlideVerify from "vue-monoplasty-slide-verify";

Vue.use(SlideVerify);

// 图片懒加载
import VueLazyload from "vue-lazyload"
import atm from "./assets/logo.png"
Vue.use(VueLazyload,{
  loading:atm
});
// 
Vue.use(ElementUI);
Vue.config.productionTip = false;
// 引入echarts
import * as echarts from "echarts";
const $echarts = require("echarts");
Vue.prototype.$echarts = $echarts;


// 公共组件
import LoadTexts from "./components/loadTexts/index.vue"
Vue.component("LoadTexts",LoadTexts)

// import "./Mock/Mock"
new Vue({
  router,
  store,

  render: (h) => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this;
  },
}).$mount("#app");
